﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.ComponentModel;

namespace Data.DataGet
{
   public class _DatHang
    {
        DataProvider ob = new SQLProvider();
        public int InsertThongTinDatHang(string MaDH, string MaNV, string MaDT, string DonViTinh, int SoLuong, DateTime NgayDH)
        {
            string SPName = "insert_ThongTinDatHang";
            SqlParameter[] para = new SqlParameter[6];
            para[0] = new SqlParameter("@MaDH", MaDH);
            para[1] = new SqlParameter("@MaNV", MaNV);
            para[2] = new SqlParameter("@MaDT", MaDT);
            para[3] = new SqlParameter("@DonViTinh", DonViTinh);
            para[4] = new SqlParameter("@SoLuong", SoLuong);
            para[5] = new SqlParameter("@NgayDH", NgayDH);
            if (ob.Execute_Modify(SPName, para) >= 1)
                return 1;
            else
                return 0;
        }
        public void UpdateThongTinDatHang(string MaDH, string MaNV, string MaDT, string DonViTinh, int SoLuong, DateTime NgayDH)
        {
            string SPName = "update_ThongTinDatHang";
            SqlParameter[] para = new SqlParameter[7];
            para[0] = new SqlParameter("@MaDH_0", MaDH);
            para[1] = new SqlParameter("@MaDH", MaDH);
            para[2] = new SqlParameter("@MaNV", MaNV);
            para[3] = new SqlParameter("@MaDT", MaDT);
            para[4] = new SqlParameter("@DonViTinh", DonViTinh);
            para[5] = new SqlParameter("@SoLuong", SoLuong);
            para[6] = new SqlParameter("@NgayDH", NgayDH);
            ob.Execute_Modify(SPName, para);
        }
        public void Delete_ThongTinDatHang(string MaDH)
        {
            string SPName = "delete_ThongTinDatHang";
            SqlParameter[] para = new SqlParameter[1];
            para[0] = new SqlParameter("@MaDH", MaDH);
            ob.Execute_Modify(SPName, para);
        }
    }
}
